//
//  KLSingleton.h
//  KoalaUtilKit
//
//  Created by Tommy on 14/12/29.
//  Copyright (c) 2014年 Alibaba-inc.com. All rights reserved.
//

#ifndef KoalaUtilKit_KLSingleton_h
#define KoalaUtilKit_KLSingleton_h
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#pragma mark - singleton
#ifndef KLSINGLETON


#undef	KLDEC_SINGLETON
#define KLDEC_SINGLETON( __class ) \
        - (__class *)sharedInstance; \
        + (__class *)sharedInstance;


#undef	KLDEF_SINGLETON
#define KLDEF_SINGLETON( __class ) \
        - (__class *)sharedInstance \
        { \
            return [__class sharedInstance]; \
        } \
        + (__class *)sharedInstance \
        { \
            static dispatch_once_t once; \
            static __class * __singleton__; \
            dispatch_once( &once, ^{ __singleton__ = [[[self class] alloc] init]; } ); \
            return __singleton__; \
        }
#endif  //KLSINGLETON



#endif
